package com.jnu.chengzhi.controller;

import com.jnu.chengzhi.dao.UserDao;
import com.jnu.chengzhi.entity.Works;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;

import javax.servlet.http.HttpSession;
import java.util.List;

/**
 * Program: ChengZhi2
 * DATE: 2022/4/6
 * Author: 周洁锋
 * Description:
 */

@Controller
public class WorkController {

    @Autowired
    private UserDao userDao;

    //打开主页
    @GetMapping("/")
    public String toIndex(HttpSession session){
        List<Works> works = userDao.getAllWorks();
        session.setAttribute("works",works);
        return "index";
    }

}
